﻿using EntityPWS;
using Google.Protobuf.WellKnownTypes;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static EntityPWS.Employee;

namespace PartyWorkSupervise.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EmployeeController : ControllerBase
    {
        private readonly ApiDbContext apiDb;
        public EmployeeController(ApiDbContext db)
        {
            apiDb = db;
        }
        [HttpGet("GetA")]
        public List<Employee> GetA()
        {
            return apiDb.employees.ToList();
        }

        [HttpGet("Get")]
        public Result Get([FromBody] Postion Postions)
        {
            Result result = new Result();
            var po = apiDb.employees.Where(w => w.Postions == Postions).FirstOrDefault<Employee>();
            result.Date = po;
            return result;

        }
    }
}
